package com.hxkj.domain.enums;

import com.platform.common.domain.exception.CustomExceptionCode;

/**
 * @EnumName ImageExceptionEnum
 * @Description TODO
 * @Author Mr.zheng
 * @Date 2018/6/5 16:01
 * @Version 1.0
 */
public enum  FileExceptionEnum implements CustomExceptionCode {

    IMAGE_UPLOAD_ERROR(300, "图片上传失败", 900),
    TEMPLET_UPLOAD_ERROR(301, "模板上传失败", 900),
    APPLET_IMG_UPLOAD_ERROR(302, "上传图片大于1M或者格式不正确,只支持gif、jpg、jpeg、bmp、png、psd或小于1M的文件", 900),
    FILE_NONE_SUPPORT_UPLOAD(303, "不支持此类文件上传", 900),
    PLEASE_FILE_UPLOAD(304, "请上传文件!", 900),

    ;

    private Integer code;
    private String msg;
    private Integer httpCode;

    FileExceptionEnum(Integer code, String msg, Integer httpCode) {
        this.code = code;
        this.msg = msg;
        this.httpCode = httpCode;
    }
    
    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Integer getHttpCode() {
        return httpCode;
    }

    public void setHttpCode(Integer httpCode) {
        this.httpCode = httpCode;
    }

    public static FileExceptionEnum getEnumByCode(Integer code){
        for(FileExceptionEnum imageExceptionEnum : FileExceptionEnum.values()){
            if(code.equals(imageExceptionEnum.getCode())){
                return imageExceptionEnum;
            }
        }
        return null;
    }
}
